/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ats.org.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ghanem
 */
@Entity
@Table(name = "GEN_CITIES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GenCity.findAll", query = "SELECT g FROM GenCity g"),
    @NamedQuery(name = "GenCity.findByCountryNo", query = "SELECT g FROM GenCity g WHERE g.genCityPK.countryNo = :countryNo"),
    @NamedQuery(name = "GenCity.findByCityNo", query = "SELECT g FROM GenCity g WHERE g.genCityPK.cityNo = :cityNo")})
public class GenCity implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected GenCityPK genCityPK;
    @Size(max = 30)
    @Column(name = "CITY_NAME")
    private String cityName;
    @Size(max = 30)
    @Column(name = "CITY_NAME_S")
    private String cityNameS;
    @Size(max = 10)
    @Column(name = "PHONE_KEY")
    private String phoneKey;
    @Column(name = "MOHE_CITY_CODE")
    private Integer moheCityCode;
    @Column(name = "MOHE_PARENT_CITY")
    private Integer moheParentCity;
    @JoinColumn(name = "COUNTRY_NO", referencedColumnName = "COUNTRY_NO", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private GenCountry genCountries;

    public GenCity() {
    }

    public GenCity(GenCityPK genCityPK) {
        this.genCityPK = genCityPK;
    }

    public GenCity(short countryNo, short cityNo) {
        this.genCityPK = new GenCityPK(countryNo, cityNo);
    }

    public GenCityPK getGenCityPK() {
        return genCityPK;
    }

    public void setGenCityPK(GenCityPK genCityPK) {
        this.genCityPK = genCityPK;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getCityNameS() {
        return cityNameS;
    }

    public void setCityNameS(String cityNameS) {
        this.cityNameS = cityNameS;
    }

    public String getPhoneKey() {
        return phoneKey;
    }

    public void setPhoneKey(String phoneKey) {
        this.phoneKey = phoneKey;
    }

    public Integer getMoheCityCode() {
        return moheCityCode;
    }

    public void setMoheCityCode(Integer moheCityCode) {
        this.moheCityCode = moheCityCode;
    }

    public Integer getMoheParentCity() {
        return moheParentCity;
    }

    public void setMoheParentCity(Integer moheParentCity) {
        this.moheParentCity = moheParentCity;
    }

    public GenCountry getGenCountries() {
        return genCountries;
    }

    public void setGenCountries(GenCountry genCountries) {
        this.genCountries = genCountries;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (genCityPK != null ? genCityPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GenCity)) {
            return false;
        }
        GenCity other = (GenCity) object;
        if ((this.genCityPK == null && other.genCityPK != null) || (this.genCityPK != null && !this.genCityPK.equals(other.genCityPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ats.edugate.model.entities.GenCity[ genCityPK=" + genCityPK + " ]";
    }
    
}
